<div class="layuimini-container">
    <form id="app-form" class="layui-form layuimini-form">

        <div class="layui-form-item">
            <label class="layui-form-label">选择商品</label>
            <div class="layui-input-block">
                <select name="product_id" lay-verify="required" data-select="{:url('jizhan.activity_product/product_list')}" data-fields="id,store_info" data-value="{$row.product_id|default=''}"
                        lay-search="">
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">商品短名称</label>
            <div class="layui-input-block">
                <input type="text" name="short_product_name" class="layui-input" lay-verify="required" placeholder="请输入划线价格" value="{$row.short_product_name}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">销售价格</label>
            <div class="layui-input-block">
                <input type="text" name="price" class="layui-input" lay-verify="required" placeholder="请输入销售价格" value="{$row.price|default=''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">划线价格</label>
            <div class="layui-input-block">
                <input type="text" name="ot_price" class="layui-input" lay-verify="required" placeholder="请输入划线价格" value="{$row.ot_price|default=''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">活动库存量</label>
            <div class="layui-input-block">
                <input type="text" name="stock" class="layui-input" lay-verify="required" placeholder="请输入活动库存量" value="{$row.stock|default=''}">
            </div>
        </div>

        <div class="hr-line"></div>
        <div class="layui-form-item text-center">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
        </div>

    </form>
</div>
<script>
    var activityId = {$activityId};
    console.log('add-activityId:'+activityId);
    layui.use(['form','jquery'], function(){
        var form = layui.form;
        var $ = layui.jquery;

        //各种基于事件的操作，下面会有进一步介绍
        var cate_id = {$row.cate_id};// 默认值
        if(cate_id == 3){
            $('#activityTime').removeClass('layui-hide');
        }else if(cate_id == 7 || cate_id == 8){
            $('#activityTime').removeClass('layui-hide');
            $('#position').removeClass('layui-hide');
        }

        var typeVal = "{$row.type}";// 默认值
        if(typeVal == ''){
            $('#short_title').addClass('layui-hide');
        }else{;
            $('#short_title').removeClass('layui-hide');
        }

        form.on('select(cate)', function(data){
            var selectVal = data.value; //得到被选中的值
            if(selectVal == 3 || selectVal == 5){
                $('#activityTime').removeClass('layui-hide');
            }else{
                $('#activityTime').addClass('layui-hide');
            }
            if(selectVal == 5){
                $('#position').removeClass('layui-hide');
            }else{
                $('#position').addClass('layui-hide');
            }
        });

        form.on('radio(demo-radio-filter1)', function(data){
            var typeVal = data.value; //得到被选中的值
            console.log();
            if(typeVal == ''){
                $('#short_title').addClass('layui-hide');
            }else{
                $('#short_title').removeClass('layui-hide');
            }
        });
    });
</script>